<?php

namespace App\Http\Controllers\Api\v1;

use App\common;
use App\Http\Controllers\Controller;
use App\server\sendsms\DxbSms;
use App\server\sendsms\SendSms;
use Illuminate\Http\Request;

class SmsController extends Controller
{
    //
    public function sms(Request $request)
    {
        try {
            if ($request->method() == 'GET'){
                $phone = $request->get('phone');
                $sms = new SendSms(new DxbSms());
                $send = $sms->send($phone);
                if ($send)
                {
                    return common::success(200,$send,'验证码发送成功');
                }
            }else{
                throw new \Exception('请求方式不对');
            }
        }catch (\Exception $exception) {
            return common::fail('', "", $exception->getMessage());
        }
    }
}
